/**
 * @(#)GtRequest.java 2011-10-9
 * 
 * Copyright 2000-2011 by ChinanetCenter Corporation.
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * ChinanetCenter Corporation ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with ChinanetCenter.
 * 
 */

package com.szf.base.web.gt;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.szf.base.web.PropertyFilter;

public class GtRequest implements Serializable {

	private static final long serialVersionUID = 1392484844604535517L;

	/** 显示列表请求 */
	public static final String ACTION_LOAD = "load";
	/** 保存列表请求 */
	public static final String ACTION_SAVE = "save";

	/** 执行的操作. 显示列表传入的action为load, 保存数据时提交的action为save. */
	private String action;

	private String recordType;

	//submit info when load
	private PageInfo pageInfo;
	private boolean remotePaging;
	// ignore columnInfo,sortInfo,filterInfo

	//additional query params
	private Map<String, Object> parameters = new HashMap<String, Object>();

	//submit info when save
	private List<String> fieldsName;
	private List<Map<String, Object>> insertedRecords;
	private List<Map<String, Object>> updatedRecords;
	private List<Map<String, Object>> deletedRecords;

	/**
	 * @return the action
	 */
	public String getAction() {
		return action;
	}

	/**
	 * @param action the action to set
	 */
	public void setAction(String action) {
		this.action = action;
	}

	/**
	 * @return the recordType
	 */
	public String getRecordType() {
		return recordType;
	}

	/**
	 * @param recordType the recordType to set
	 */
	public void setRecordType(String recordType) {
		this.recordType = recordType;
	}

	/**
	 * @return the pageInfo
	 */
	public PageInfo getPageInfo() {
		return pageInfo;
	}

	/**
	 * @param pageInfo the pageInfo to set
	 */
	public void setPageInfo(PageInfo pageInfo) {
		this.pageInfo = pageInfo;
	}

	/**
	 * @return the remotePaging
	 */
	public boolean isRemotePaging() {
		return remotePaging;
	}

	/**
	 * @param remotePaging the remotePaging to set
	 */
	public void setRemotePaging(boolean remotePaging) {
		this.remotePaging = remotePaging;
	}

	/**
	 * @return the fieldsName
	 */
	public List<String> getFieldsName() {
		return fieldsName;
	}

	/**
	 * @param fieldsName the fieldsName to set
	 */
	public void setFieldsName(List<String> fieldsName) {
		this.fieldsName = fieldsName;
	}

	/**
	 * @return the parameters
	 */
	public Map<String, Object> getParameters() {
		return parameters;
	}

	/**
	 * @param parameters the parameters to set
	 */
	public void setParameters(Map<String, Object> parameters) {
		this.parameters = parameters;
	}

	public void addParameter(PropertyFilter propertyFilter) {
		this.parameters.put(propertyFilter.getPropertyName(), propertyFilter
				.getPropertyValueWithMatchCheck());
	}

	/**
	 * @return the insertedRecords
	 */
	public List<Map<String, Object>> getInsertedRecords() {
		return insertedRecords;
	}

	/**
	 * @param insertedRecords the insertedRecords to set
	 */
	public void setInsertedRecords(List<Map<String, Object>> insertedRecords) {
		this.insertedRecords = insertedRecords;
	}

	/**
	 * @return the updatedRecords
	 */
	public List<Map<String, Object>> getUpdatedRecords() {
		return updatedRecords;
	}

	/**
	 * @param updatedRecords the updatedRecords to set
	 */
	public void setUpdatedRecords(List<Map<String, Object>> updatedRecords) {
		this.updatedRecords = updatedRecords;
	}

	/**
	 * @return the deletedRecords
	 */
	public List<Map<String, Object>> getDeletedRecords() {
		return deletedRecords;
	}

	/**
	 * @param deletedRecords the deletedRecords to set
	 */
	public void setDeletedRecords(List<Map<String, Object>> deletedRecords) {
		this.deletedRecords = deletedRecords;
	}

}
